import { IParam } from '../../common';
import { IFormAbility } from '../ability';
import { ICtrlActionResult } from '../data-action';
import { IFormStore } from '../store';
import { IFormController } from './i-form-controller';

/**
 * 编辑表单控制器接口
 *
 * @export
 * @interface IEditFormController
 * @extends {IFormController<S, A>}
 * @template S
 * @template A
 */
export interface IEditFormController<
	S extends IFormStore,
	A extends IFormAbility
> extends IFormController<S, A> {
	/**
	 * 加载数据
	 *
	 * @param {IParam} [opts] 行为参数
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IEditFormController
	 */
	load(opts?: IParam): Promise<ICtrlActionResult>;

	/**
	 * 保存数据
	 *
	 * @param {IParam} [opts] 行为参数
	 * @param {boolean} [showResultInfo] 是否显示结果信息
	 * @param {boolean} [isStateNext] 是否执行保存关系界面
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IEditFormController
	 */
	save(
		opts?: IParam,
		showResultInfo?: boolean,
		isStateNext?: boolean
	): Promise<ICtrlActionResult>;

	/**
	 * 删除
	 *
	 * @param {IParam} [opts] 行为参数
	 * @return {*}  {Promise<ICtrlActionResult>}
	 * @memberof IEditFormController
	 */
	remove(opts?: IParam): Promise<ICtrlActionResult>;
}
